class Solution:
    def longestCommonPrefix(self, strs: list[str]) -> str:
        ser = ''
        for index, i in enumerate(strs[0]):
            for j in strs[1:]:
                if index+1>len(j) or j[index] != i:
                    return ser
            ser += i
        return ser


lll = Solution()
print(lll.longestCommonPrefix(['ab','a']))
